{include file="./headStart.tpl"}
{literal}
<script type="text/javascript">
	$(document).ready(function(){   
    $("#partyId").change(function(){ 
    	//alert("dadashree");
    	var dataString = "partyId=" + $(this).val();
    	  $.ajax({
       	  type: "GET",
          url:  "paryViewAj.php",
          data: dataString,
          success: function(data){ 
          $("#partyType").html(data);
        }
      });
   });
  $(".branchId").change(function(){ 
   var dataString = "branchId=" + $(this).val();
    $.ajax({
      type: "GET",
      url:  "paryViewAj.php",
      data: dataString,
      success: function(data){ 
      $("#partyType").html(data);
     }
   });
  });
});
$(document).ready(function() {
	// validate the contact form
	$("#frmParty").validate({
		rules: {
			contactPerson1: { required: true, minlength: 2 },
			mobile1: { required: true, minlength: 10, maxlength: 11 },
			address: { required: true, minlength: 2 }
		},
		messages: {
			contactPerson1: "<img id='emailerror' src='./images/cross.png' height='10' width='10'/>",
			mobile1: "<img id='emailerror' src='./images/cross.png' height='10' width='10'/>",
			address: "<img id='emailerror' src='./images/cross.png' height='10' width='10'/>"
		},
		success:function(label){
			label.html("<img src='./images/right.jpg' height='10' width='10' alt='Valid'>");
		},
	});
});

function myFunction()
{
	if(confirm("Are You Sure To Delete")== true)
	{
		return true;
	}
	else
	{
		return false;
	}
}
</script>      
{/literal}
{include file="./headEnd.tpl"}
<form name="frmParty" action="{$smarty.server.PHP_SELF}" method="post" id="frmParty">
<input type="hidden" name="challanShort" value="{$challanShort}" />
<input type="hidden" name="partyId" value="{$partyId}" />  
<input type="hidden" name="redirectFrom" value="{$redirectFrom}" />
<table align="center" border="1" cellpadding="2" cellspacing="1" >
<tr>
  <td align="center" class="table1" colspan="4">Customer Entry</td>
</tr>
<tr>
	<td class="table2" align="left"><label for="companyName">Company Name:</label></td>
  <td class="table2" colspan="3"><input type="text" name="companyName" id="companyName" value="{$companyName}" size="65"></td>
</tr>
<tr>
  <td class="table2" align="left">Contact Person - 1 <font color="red"> *</font> :</td>
  <td class="table2"><input type="text" name="contactPerson1" id="contactPerson1"  value="{$contactPerson1}"></td>
  <td class="table2" align="left">Mobile 1 <font color="red"> *</font> :</td>
  <td class="table2"><input type="text" name="mobile1" id="mobile1" value="{$mobile1}"></td>
</tr>
<tr>
  <td class="table2" align="left">Contact Person - 2 :</td>
  <td class="table2"><input type="text" name="contactPerson2" id="contactPerson2" value="{$contactPerson2}"></td>
  <td class="table2" align="left">Mobile 2 :</td>
  <td class="table2"><input type="text" name="mobile2" value="{$mobile2}"></td>
</tr>
<tr>
  <td class="table2" align="left">Contact Person - 3 :</td>
  <td class="table2"><input type="text" name="contactPerson3" id="contactPerson3" value="{$contactPerson3}"></td>
  <td class="table2" align="left">Mobile 3 :</td>
  <td class="table2"><input type="text" name="mobile3" value="{$mobile3}"></td>
</tr>
<tr>
	<tr>
  <td class="table2" align="left">Landline No<font color="red"> *</font> :</td>
  <td class="table2"><input type="text" name="phoneNo" id="phoneNo" value="{$phoneNo}"></td>
  <td class="table2" align="left">Branch :</td>
  <td class="table2" align="left">
    <select name="branchId" id="branchId">
      {html_options values=$branchArray.branchId output=$branchArray.branchName selected=$branchSelected}
    </select>
  </td>
</tr>
<tr>
  <td class="table2" align="left">Address<font color="red"> *</font> :</td>
  <td class="table2" colspan="3"><textarea  name="address" id="address" rows="3" cols="44">{$address}</textarea></td>
</tr>
<tr>
  <td class="table2" align="left">City :</td>
  <td class="table2"><input type="text" name="city" value="{$city}"></td>
  <td class="table2" align="left">Email :</td>
  <td class="table2"><input type="text" name="email" value="{$email}"></td>
</tr>
<tr>
  <td class="table2">&nbsp</td>
  <td class="table2" align="center" ><input class="button" type="submit" name="insertBtn" value="Submit" />
  </td>
  <td class="table2" colspan="3">
  {if $partyId > 0}
  <input class="button" type="submit" name="cancelBtn" value="Cancel" />
  {else}
  &nbsp;
  {/if}
  </td>
</tr>
</table>
</form> 
<table border='0' cellpadding='1' cellspacing='2' align='center'>
  <td class="table2">
    <select name="partyId" id="partyId">
    <option value="0">All</option>
      {html_options values=$partyArray.partyId output=$partyArray.companyName selected=$partySelected}
    </select>
  </td> 
  <td class="table2" id="branchpara">
    <select name="branchId" id="branchId" class="branchId">
      {html_options values=$branchArray.branchId output=$branchArray.branchName selected=$branchSelected}
    </select>
  </td>
 </table>
<div id="partyType">
<table border='0' cellpadding='1' cellspacing='2' align='center'> 
<tr>
  <td class="table1" align="center" colspan="12"><font style="font-size: 16px"><b> Customer Available </b></font></td>
</tr>
<tr>
  <!--<td  class="table1" align='center' ><B>&nbsp;</td>-->
  <td  class="table3" align='center' ><B>&nbsp;</td>
  <td  class="table3" align='center' ><B>&nbsp;</td>
  <td  class="table3" align='center' ><B>Sr.No</td>
	<td  class="table3" align='center' ><B>Company Name</td>
	<td  class="table3" align='center' ><B>Contact Person1</td>
	<td  class="table3" align='center' ><B>Contact Person2</td>
	<td  class="table3" align='center' ><B>Contact Person3</td>
	<td  class="table3" align='center' ><B>Landline No</td>
	<td  class="table3" align='center' ><B>Mobile</td>
	<td  class="table3" align='center' ><B>City</td>
	<td  class="table3" align='center' ><B>Email</td>
</tr>
{section name="sec1" loop=$partyItemDetailArray}
<tr>
  <td class="table3" align="center">
    <a href="party.php?partyId={$partyItemDetailArray[sec1].partyId}" class="link" onclick="return myFunction();"><img src="./images/b_edit.png" border="0" width="15" height="15"></a>
  </td>
  <td class="table3" align="center">  
	  <a href="partyDelete.php?partyId={$partyItemDetailArray[sec1].partyId}" class="link" onclick="return myFunction();"><img src="./images/deleteIcon.png" border="0" width="15" height="15"></a>
  </td>
  <td class="table3" align="center">{$smarty.section.sec1.rownum}</td>
  <td class="table3" align="left" id="tooltip"> {$partyItemDetailArray[sec1].companyName}
  	<span>Address :{$partyItemDetailArray[sec1].address}</span>
  </td>
  <td class="table3" align="left" id="tooltip"> {$partyItemDetailArray[sec1].contactPerson1}
    <span>Mobile 1:{$partyItemDetailArray[sec1].mobile1}</span>
  </td>
  <td class="table3" align="left" id="tooltip">{$partyItemDetailArray[sec1].contactPerson2}
    <span>Mobile 2:{$partyItemDetailArray[sec1].mobile2}</span>
  </td>
  <td class="table3" align="left" id="tooltip"> {$partyItemDetailArray[sec1].contactPerson3}
    <span>Mobile 3:{$partyItemDetailArray[sec1].mobile3}</span>
  </td>
  <td class="table3" align="left"> {$partyItemDetailArray[sec1].phoneNo}</td>
  <td class="table3" align="left"> {$partyItemDetailArray[sec1].mobile1}</td>
  <td class="table3" align="left"> {$partyItemDetailArray[sec1].city}</td>
  <td class="table3" align="left"> {$partyItemDetailArray[sec1].email}</td>
</tr>
{/section}
</table>
</div>
{include file="footer.tpl"}